﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using Model.Entity.Members;

namespace LibraryManagerTests.Model.Entity.Members
{

    /// <summary>
    /// Class containing unit tests for classes in Model.Entity.Members.
    /// </summary>
    [TestClass]
    public class MemberTests
    {

        /// <summary>
        /// Tests Member class' subclasses, if they return the correct values for GetActiveBorrowLimit() and 
        /// GetBorrowDurationLimit().
        /// </summary>
        [TestMethod]
        public void TestMembers()
        {
            ForeignUniMember foreign = new ForeignUniMember();
            LocalStudent student = new LocalStudent();
            LocalTeacher teacher = new LocalTeacher();
            Other other = new Other();

            // foreign
            Assert.AreEqual(foreign.GetActiveBorrowLimit(), 4);
            Assert.AreEqual(new TimeSpan(30, 0, 0, 0), foreign.GetBorrowDurationLimit());

            // m
            Assert.AreEqual(student.GetActiveBorrowLimit(), 5);
            Assert.AreEqual(new TimeSpan(60, 0, 0, 0), student.GetBorrowDurationLimit());
            // teacher
            Assert.AreEqual(teacher.GetActiveBorrowLimit(), short.MaxValue);
            Assert.AreEqual(new TimeSpan(365, 0, 0, 0), teacher.GetBorrowDurationLimit());

            // other
            Assert.AreEqual(other.GetActiveBorrowLimit(), 2);
            Assert.AreEqual(new TimeSpan(14, 0, 0, 0), other.GetBorrowDurationLimit());
        }
    }
}
